home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / pp / pp-6.0 / h / retcode.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-12-18  |  7.0 KB  |  251 lines

  1. /* retcode.h: reply & status codes used throughout pp */
  2.  
  3. /*
  4.  * @(#) $Header: /xtel/pp/pp-beta/h/RCS/retcode.h,v 6.0 1991/12/18 20:42:44 jpo Rel $
  5.  *
  6.  * $Log: retcode.h,v $
  7.  * Revision 6.0  1991/12/18  20:42:44  jpo
  8.  * Release 6.0
  9.  *
  10.  *
  11.  */
  12.  
  13.  
  14.  
  15. #ifndef _H_RETCODE
  16. #define _H_RETCODE
  17.  
  18.  
  19.  
  20. /*
  21. ------------------------------------------------------------------------------
  22.  
  23.             Reply Codes for PP
  24.  
  25.  Based on: "Revised FTP Reply Codes", by Jon Postel & Nancy Neigus Arpanet
  26.      RFC 640 / NIC 30843, in the "Arpanet Protocol Handbook", E.  Feinler
  27.      and J. Postel (eds.), NIC 7104, Network Information Center, SRI
  28.      International:  Menlo Park, CA.  (NTIS AD-A0038901)
  29.  
  30.  Basic format:
  31.  
  32.      0yz: positive completion; entire action done
  33.      1yz: positive intermediate; only part done
  34.      2yz: Transient negative completion; may work later
  35.      3yz: Permanent negative completion; you lose forever
  36.  
  37.      x0z: syntax
  38.      x1z: general; doesn't fit any other category
  39.      x2z: connections; truly transfer-related
  40.      x3z: user/authentication/account
  41.      x4x: mail
  42.      x5z: file system
  43.  
  44.      3-bit z field is unique to the reply.  In the following,
  45.      the RP_xVAL defines are available for masking to obtain a field.
  46.  
  47. ------------------------------------------------------------------------------
  48. */
  49.  
  50.  
  51. /* ++++++++++++++  Field Definitions & Basic Values  +++++++++++++++++++++ */
  52.  
  53.  
  54. /*
  55. Field 1:  Basic degree of success (2-bits)
  56. */
  57.  
  58. #define RP_BTYP         0200            /* good vs. bad; on => bad */
  59.  
  60. #define RP_BVAL         0300            /* basic degree of success */
  61.  
  62. #define RP_BOK          0000            /* went fine; all done */
  63. #define RP_BPOK         0100            /* only the first part got done */
  64. #define RP_BTNO         0200            /* temporary failure; try later */
  65. #define RP_BNO          0300            /* not now, nor never; you lose */
  66.  
  67.  
  68. /*
  69. Field 2:  Basic domain of discourse (3-bits)
  70. */
  71.  
  72. #define RP_CVAL         0070            /* basic category (domain) of reply */
  73.  
  74. #define RP_CSYN         0000            /* purely a matter of form */
  75. #define RP_CGEN         0010            /* couldn't find place for it */
  76. #define RP_CCON         0020            /* data-transfer-related issue */
  77. #define RP_CUSR         0030            /* pertaining to the user */
  78. #define RP_CMAI         0040            /* specific to mail semantics */
  79. #define RP_CFIL         0050            /* file system */
  80. #define RP_CLIO         0060            /* local i/o system */
  81.  
  82. /*
  83. Field 3:  Specific value for this reply (3-bits)
  84. */
  85.  
  86. #define RP_SVAL         0007            /* specific value of reply */
  87.  
  88.  
  89. /* ++++++++++++++++++++  Specific Success Values  ++++++++++++++++++++++++ */
  90.  
  91.  
  92. /*
  93. Complete Success
  94. */
  95.  
  96. #define RP_DONE         (RP_BOK | RP_CGEN | 0000)
  97.             /* done (e.g., w/transaction) */
  98. #define RP_OK           (RP_BOK | RP_CGEN | 0001)
  99.             /* general-purpose OK */
  100. #define RP_MOK          (RP_BOK | RP_CMAI | 0000)
  101.             /* message is accepted (w/text) */
  102. #define RP_DOK          (RP_BOK | RP_CGEN | 0003)
  103.             /* accepted for the delayed submission channel  */
  104.  
  105.  
  106. /*
  107. Partial Success
  108. */
  109.  
  110. #define RP_MAST         (RP_BPOK| RP_CGEN | 0000)
  111.             /* you are the requestor */
  112. #define RP_SLAV         (RP_BPOK| RP_CGEN | 0001)
  113.             /* you are the requestee */
  114. #define RP_AOK          (RP_BPOK| RP_CMAI | 0000)
  115.             /* message address is accepted */
  116. #define RP_HOK          (RP_BPOK| RP_CMAI | 0001)
  117.             /* host processing completed */
  118.  
  119.  
  120. /* ++++++++++++++++++++  Specific Failure Values  ++++++++++++++++++++++++ */
  121.  
  122.  
  123. /*
  124. Partial Failure
  125. */
  126.  
  127. #define RP_AGN          (RP_BTNO | RP_CGEN | 0000)
  128.             /* not now; maybe later */
  129. #define RP_TIME         (RP_BTNO | RP_CGEN | 0001)
  130.             /* timeout */
  131. #define RP_NOOP         (RP_BTNO | RP_CGEN | 0002)
  132.             /* no-op; nothing done, this time */
  133. #define RP_EOF          (RP_BTNO | RP_CGEN | 0003)
  134.             /* encountered an end of file */
  135. #define RP_NET          (RP_BTNO | RP_CCON | 0000)
  136.             /* channel went bad */
  137. #define RP_BHST         (RP_BTNO | RP_CCON | 0001)
  138.             /* foreign host screwed up */
  139. #define RP_DHST         (RP_BTNO | RP_CCON | 0002)
  140.             /* host went away */
  141. #define RP_NIO          (RP_BTNO | RP_CCON | 0004)
  142.             /* general net i/o problem */
  143. #define RP_NS           (RP_BTNO | RP_CCON | 0005)
  144.             /* temporary nameserver failure */
  145. #define RP_FIO          (RP_BTNO | RP_CFIL | 0000)
  146.             /* error reading/writing file */
  147. #define RP_FCRT         (RP_BTNO | RP_CFIL | 0001)
  148.             /* unable to create file */
  149. #define RP_FOPN         (RP_BTNO | RP_CFIL | 0002)
  150.             /* unable to open file */
  151. #define RP_LIO          (RP_BTNO | RP_CLIO | 0000)
  152.             /* general local i/o problem */
  153. #define RP_LOCK         (RP_BTNO | RP_CLIO | 0001)
  154.             /* resource currently locked */
  155.  
  156.  
  157. /*
  158. Complete Failure
  159. */
  160.  
  161. #define RP_MECH         (RP_BNO | RP_CGEN | 0000)
  162.             /* bad mechanism/path; try alternate? */
  163. #define RP_NO           (RP_BNO | RP_CGEN | 0001)
  164.             /* general-purpose NO */
  165. #define RP_BAD          (RP_BNO | RP_CGEN | 0002)
  166.             /* another general purpose NO */
  167. #define RP_PROT         (RP_BNO | RP_CCON | 0000)
  168.             /* general prototocol error */
  169. #define RP_RPLY         (RP_BNO | RP_CCON | 0001)
  170.             /* bad reply code (PERMANENT ERROR)   */
  171. #define RP_NAUTH        (RP_BNO | RP_CUSR  | 0001)
  172.             /* bad authorisation */
  173.             /* SEK this will be used for user checks*/
  174. #define RP_NDEL         (RP_BNO | RP_CMAI | 0000)
  175.             /* couldn't deliver */
  176. #define RP_HUH          (RP_BNO | RP_CSYN | 0000)
  177.             /* couldn't parse the request */
  178. #define RP_NCMD         (RP_BNO | RP_CSYN | 0001)
  179.             /* no such command defined */
  180. #define RP_PARM         (RP_BNO | RP_CSYN | 0002)
  181.             /* bad parameter */
  182. #define RP_UCMD         (RP_BNO | RP_CSYN | 0003)
  183.             /* command not implemented */
  184. #define RP_PARSE        (RP_BNO| RP_CSYN | 0004)
  185.             /* address parse error */
  186. #define RP_USER         (RP_BNO | RP_CUSR | 0000)
  187.             /* unknown user */
  188.  
  189.  
  190. /*
  191. Structure of a Reply String
  192. */
  193.  
  194.  
  195. struct rp_construct     /* for constant reply conditions */
  196. {
  197.     unsigned char       rp_cval;
  198.     char                rp_cline[50];
  199. };
  200.  
  201.  
  202. struct rp_bufstruct     /* for reading reply strings */
  203. {
  204.     unsigned char       rp_val;
  205.     char                rp_line[256];
  206. };
  207.  
  208.  
  209. typedef struct rp_bufstruct     RP_Buf;
  210.  
  211. #define rp_conlen(bufnam) (strlen (bufnam.rp_cline) + sizeof (bufnam.rp_cval))
  212.  
  213.  
  214.  
  215. /*
  216. Pseudo-functions to access reply info
  217. */
  218.  
  219. #define rp_gval(val)    ((val) & 0377)
  220.             /* get the value of the return code */
  221. /*
  222. The next three give the field's bits, within the whole value
  223. */
  224.  
  225. #define rp_gbval(val)   ((val) & RP_BVAL)
  226.             /* get the basic part of return value */
  227. #define rp_gcval(val)   ((val) & RP_CVAL)
  228.             /* get the domain part of value */
  229. #define rp_gsval(val)   ((val) & RP_SVAL)
  230.             /* get the specific part of value */
  231.  
  232. /*
  233. The next three give the numeric value withing the field
  234. */
  235.  
  236. #define rp_gbbit(val)   (((val) >> 6) & 03)
  237.             /* get the basic part right-shifted */
  238. #define rp_gcbit(val)   (((val) >> 3 ) & 07)
  239.             /* get the domain part right-shifted */
  240. #define rp_gsbit(val)   ((val) & 07)
  241.             /* get the specific part right-shifted */
  242. #define rp_isgood(val)  (! rp_isbad(val))
  243.             /* is return value positive? */
  244. #define rp_isbad(val)   ((val) & 0200)
  245.             /* is return value negative? */
  246.  
  247. extern char *rp_valstr ();
  248.  
  249.  
  250. #endif
  251.